package com.zjun.demo.experimentaldemo.util_test

import android.view.View
import com.zjun.demo.experimentaldemo.R
import com.zjun.demo.experimentaldemo.base.BaseActivity
import com.zjun.demo.experimentaldemo.databinding.ActivityUtilTestBinding
import com.zjun.demo.experimentaldemo.utils.PackageUtil

/**
 * 工具类测试
 */
class UtilTestActivity : BaseActivity<ActivityUtilTestBinding>() {

    override fun initialize() {}

    override fun getLayoutId(): Int = R.layout.activity_util_test

    /**
     * 判断是否安装某个应用
     * android11以上需要在AndroidManifest manifest节点下添加所需的包名
     * ```xml
     * <queries>
     *    <package android:name="com.tencent.mobileqq" />
     * </queries>
     * ```
     */
    fun testIsPackageInstalled(view: View) {
        PackageUtil.init(this)
        val qqIsInstalled  = PackageUtil.isPackageInstalled("com.tencent.mobileqq")
        val result = "QQ是否安装 = $qqIsInstalled"
        mBinding.tvResponse.text = result
    }

}